﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows.Shapes;

namespace Hugo
{
    public class BackgroundCanvas : Canvas
    {
        public void setBackground(System.Drawing.Bitmap b) {
            Rectangle newBgRect = Util.getUnCenteredSymbol(
                Util.getBitmapSource(b), 100, 100
                );
            newBgRect.Width = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;
            newBgRect.Height = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;

            this.Children.Add(newBgRect);

            if (this.Children.Count > 1)
            {
                System.Windows.UIElement e = this.Children[0];
                this.Children.Remove(e);
            }
            
            Canvas.SetLeft(newBgRect, 0);
            Canvas.SetTop(newBgRect, 0);
        }

        internal void clearBg()
        {
            if (this.Children.Count >= 1)
            {
                this.Children.RemoveAt(0);
            }
        }
    }
}
